import React, { Component } from 'react'
import B from './B'
import context from './context'
const {Provider}  = context

export default class A extends Component {
    state = {car:'奔驰G500',name:'老刘'}
    render() {
        return (
            <div style={{background:'skyblue',padding:'10px'}}>
                <h1>我是A组件,我有台车{this.state.car}</h1>
                <Provider value={{...this.state}}>
                    <B/>
                </Provider>
            </div>
        )
    }
}
